package com.leetcode;

import java.util.Random;
public class Test_4 {
    public static void main(String[] args) {
        Random random = new Random();
       double [][]score=new double[10][5];
        for(int i=0;i<score.length;i++){
            for(int j=0;j<score[i].length;j++){
                score[i][j]=random.nextInt(100)*1.0+1;
            }
        }
        //输出成绩
        for(int i=0;i<score.length;i++){
            for(int j=0;j<score[i].length;j++){
                System.out.print(score[i][j]+"|\t");
            }
            System.out.println("");
        }
        //输出每个同学的总分
        System.out.println("======输出每个同学的总分=====");
        for(int i=0;i< score.length;i++){
            double sum=0;
            for(int j=0;j<score[i].length;j++){
                sum+=score[i][j];
            }
            System.out.println(sum);
        }
        System.out.println("======输出每个同学课程的平均分======");
        for(int i=0;i< score.length;i++){
            double avg=0;
            double sum=0;
            for(int j=0;j<score[i].length;j++){
                sum+=score[i][j];
            }
            avg=sum/score[i].length;
            System.out.println(avg);
        }
    }
}
